<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>商家完善资料</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
	name="viewport">

<link rel="stylesheet"
	href="seller/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="seller/plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet"
	href="seller/plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="seller/css/style.css">
<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="layui/css/layui.mobile.css">

<script src="seller/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="seller/plugins/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript">

			$(function(){
			 $("#name").blur(function(){
			
				var node=$("#name").val();
				 $.ajax({
	                   url:"findSellerName.action",
	                   data:{"name":node},//==》"name="+node           '{"name":"node"}'json字符串
	                   	                   
	                   success:function(res){//res为相应体,function为回调函数
	                   
				           if(res=='false'){

				           layer.alert('公司名已经存在！！！',{anim: 1,closeBtn:0,icon: 1});
	
				           }
				           else{
				            layer.msg('太棒啦！公司名可以使用哦^_^',{anim: 1,time:5000,icon:1});
				           }
				           }  });
	            });
			
			
			})

 layui.use('form', function(){
		  var form = layui.form;

	 	form.verify({//对名字进行验证
		  name: function(value, item){ //value：表单的值、item：表单的DOM对象
			    if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
			      return '用户名不能有特殊字符';
			    }
			    if(/(^\_)|(\__)|(\_+$)/.test(value)){
			      return '用户名首尾不能出现下划线\'_\'';
			    }
			    if(/^\d+\d+\d$/.test(value)){
			      return '用户名不能全为数字';
			    }  
		  },
		
            
		 
		  
		  //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
		 
		  phone:[
		  	/^1[34578][0-9]{9}$/,
		  	'手机号不合法' 
		  ] ,
		   identity: [
            /^[1-9]\d{5}(18|19|[23]\d)\d{2}(0[1-9]|1[0-2])([0-2][1-9]|10|20|30|31)\d{3}[\dX]$|^[1-9]\d{5}\d{2}(0[1-9]|1[0-2])([0-2][1-9]|10|20|30|31)\d{3}$/
            , '请输入正确的身份证号'
          ]
          ,telephone:[
          	/^\d{8}$/,
          	'输入正确的电话'
          
          ]
          ,
          bankcardNum:[
          /^([1-9]{1})(\d{14}|\d{18})$/,
          '请输入正确的银行卡号'
          
          ]
          ,licenseNumber:[
           /^\d{15}$/,
           '请输入正确的营业执照15个纯数字'

          ],
          orgNumber:[
          /^[\dA-Z]{8}[X\d]$/,
          '输入正确的组织机构代码'
           ]
           ,legalPerson:[
            /^[\u4e00-\u9fa5]{2,5}|[a-zA-Z]{4,8}$/,
           '法定人的名字全英文4-8之间或者全汉字2-5之间'
          
           ],
           bankUser:[
           		/^[\u4e00-\u9fa5]{4,8}$/,
           		'输入正确的银行名'
           ],
           bankname:[
           /^[\u4e00-\u9fa5]{5,15}$/,
           '输入正确的银行支行5-15位之间'
   				]
		}); 
			
		
		          //监听提交
				  form.on('submit(demo1)', function(data){
				    //layer.msg(JSON.stringify(data.field));//获取的表单所有信息
				    //alert(JSON.stringify(data.field));
		  
				    $.ajax({
				          url:"updateSellerMessage.action",
				          type:'post',//method请求方式，get或者post
				          //async:true,
				          data:JSON.stringify(data.field),//表格数据序列化
				          contentType: "application/json; charset=utf-8",
				          success:function(res){//res为相应体,function为回调函数
				            //alert(res+"----");
				           //  layer.alert(res,{anim: 1,closeBtn:0,icon: 1});
				             
				             window.location.href="findSellerMessage.action";
				          },
				          error:function(){
				            layer.alert('操作失败哦，亲！！！',{anim: 1});
				          }
				        });
				        
								    
				  });
});

</script>

</head>


<body class="hold-transition skin-red sidebar-mini">
<section class="layui-larry-box">
<form class="layui-form" method="post" id="userform">
	<!-- 正文区域 -->
	<section class="content">

	<div class="box-body">

		<!--tab页-->
		<div class="nav-tabs-custom">

			<!--tab头-->
			<ul class="nav nav-tabs">

				<li class="active"><a href="#home" data-toggle="tab">商家信息</a></li>
			</ul>
			<!--tab头/-->

			<!--tab内容-->
			<div class="tab-content">

				<!--表单内容-->
				<div class="tab-pane active" id="home">
					<div class="row data-type">
                       <input type="hidden" name="sellerId" value="${SellerBaseMsg.sellerId}">
							<div class="col-md-2 title layui-form-item">公司名称</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="公司名称"
								id="name" name="name" lay-verify="required|name" value="${SellerBaseMsg.name}" >
						</div>
						
						

					   <div class="col-md-2 title layui-form-item">公司手机</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="公司手机"
								name="mobile" lay-verify="required|phone" value="${SellerBaseMsg.mobile}">
						</div>

						<div class="col-md-2 title layui-form-item">公司电话</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="公司电话"
								name="telephone" lay-verify="required|" value="${SellerBaseMsg.telephone}">
						</div>

						<div class="col-md-2 title layui-form-item">公司详细地址</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="公司详细地址"
								name="addressDetail" lay-verify="required" value="${SellerBaseMsg.addressDetail}">
						</div>

						<div class="col-md-2 title layui-form-item">联系人姓名</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="联系人姓名"
								name="linkmanName" lay-verify="required|legalPerson" value="${SellerBaseMsg.linkmanName}">
						</div>

						<div class="col-md-2 title layui-form-item">联系人QQ</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="联系人QQ"
							name="linkmanQq"	value="${SellerBaseMsg.linkmanQq}">
						</div>

						<div class="col-md-2 title layui-form-item">联系人手机</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="联系人手机"
								name="linkmanMobile" lay-verify="required|phone" value="${SellerBaseMsg.linkmanMobile}">
						</div>

						<div class="col-md-2 title layui-form-item">联系人EMAIL</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="联系人EMAIL"
								name="linkmanEmail" lay-verify="required|email"  value="${SellerBaseMsg.linkmanEmail}">
						</div>

						<div class="col-md-2 title layui-form-item">营业执照号</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="营业执照号"
								name="licenseNumber" lay-verify="required|licenseNumber" value="${SellerBaseMsg.licenseNumber}">
						</div>

						<div class="col-md-2 title layui-form-item">税务登记证号</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="税务登记证号"
							name="taxNumber" lay-verify="required|licenseNumber"	value="${SellerBaseMsg.taxNumber}">
						</div>

						<div class="col-md-2 title layui-form-item">组织机构代码证</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="组织机构代码证"
								name="orgNumber" lay-verify="required|orgNumber" value="${SellerBaseMsg.orgNumber}">
						</div>

						<div class="col-md-2 title layui-form-item">法定代表人</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="法定代表人"
							name="legalPerson" lay-verify="required|legalPerson"	value="${SellerBaseMsg.legalPerson}">
						</div>

						<div class="col-md-2 title layui-form-item">法定代表人身份证号</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="法定代表人身份证号"
							name="legalPersonCardId" lay-verify="required|identity"	value="${SellerBaseMsg.legalPersonCardId}">
						</div>

						<div class="col-md-2 title layui-form-item">开户行名称</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="开户行名称"
								name="bankUser" lay-verify="required|bankUser"  value="${SellerBaseMsg.bankUser}">
						</div>

						<div class="col-md-2 title layui-form-item">开户行支行</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="开户行支行"
								name="bankName" lay-verify="required|bankname" value="${SellerBaseMsg.bankName}">
						</div>

						<div class="col-md-2 title layui-form-item">银行账号</div>
						<div class="col-md-10 data layui-bg-gray">
							<input type="text" class="form-control" placeholder="银行账号"
								name="bankcardNum" lay-verify="required|bankcardNum" value="${SellerBaseMsg.bankcardNum}">
						</div>

					</div>
				</div>
			</div>
			<!--tab内容/-->
			<!--表单内容/-->

		</div>




	</div>
		<div class="layui-form-item">		
	    <div class="layui-input-block  layui-anim layui-anim-rotate">
	      <button class="layui-btn" lay-submit="" lay-filter="demo1" onclick="return false">立即提交</button>
	    </div>   
	  </div>
	</section>
	<!-- 正文区域 /-->
</form>
</section>

</body>

</html>